package com.example.flutter_projectname_getx;

import io.flutter.embedding.android.FlutterActivity;
import androidx.annotation.NonNull;

import com.example.flutter_projectname_getx.constant.Constant;

import io.flutter.embedding.android.FlutterActivity;
import io.flutter.embedding.engine.FlutterEngine;
import io.flutter.plugin.common.MethodChannel;

public class MainActivity extends FlutterActivity {

    /**
     * 原生与Flutter交互
     * */
    @Override
    public void configureFlutterEngine(@NonNull FlutterEngine flutterEngine) {
        super.configureFlutterEngine(flutterEngine);
        new MethodChannel(flutterEngine.getDartExecutor().getBinaryMessenger(), Constant.CHANNEL)
                .setMethodCallHandler( (call, result) -> {
                            // Note: this method is invoked on the main thread.
                            FlutterAndroidCall.methodCallHandler(call,result);
                        }
                );
    }
}
